import http from '@/utils/http'

import type * as T from './type'

export type * from './type'

const BASE_URL = '/asset/device/model'

/** @desc 查询设备型号列表 */
export function listDeviceModel(query: T.DeviceModelPageQuery) {
  return http.get<PageRes<T.DeviceModelResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询设备型号详情 */
export function getDeviceModel(id: string) {
  return http.get<T.DeviceModelDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增设备型号 */
export function addDeviceModel(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 修改设备型号 */
export function updateDeviceModel(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除设备型号 */
export function deleteDeviceModel(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 导出设备型号 */
export function exportDeviceModel(query: T.DeviceModelQuery) {
  return http.download(`${BASE_URL}/export`, query)
}
